<?php
/**
 * Created by JiangJiaCai.
 * User: Administrator
 * Date: 2017/9/22 0022
 * Time: 9:43
 */

namespace App\Http\Controllers\home;


use App\Http\Controllers\BaseController;
use App\Models\QdcsOrg;
use com_jjcbs\lib\ServiceFactory;
use ext\fun\Helper;
use ext\service\ArticleServiceImpl;
use ext\service\OrgServiceImpl;
use ext\service\ProjectServiceImpl;

class IndexController extends BaseController
{
    private $articleService = null;

    private $orgService = null;
    private $projectService = null;

    public function __construct()
    {
        parent::__construct();
        $this->articleService = ServiceFactory::getInstance(ArticleServiceImpl::class);
        $this->orgService = ServiceFactory::getInstance(OrgServiceImpl::class);
        $this->projectService = ServiceFactory::getInstance(ProjectServiceImpl::class);
    }

    public function index()
    {
        $this->model['topList'] = $this->articleService->getOneTop();
        $this->model['noticeList'] = Helper::GA(26, 10);
        $this->model['imgArticleList'] = Helper::GAImgNews();
        $this->model['imgHelpList'] = Helper::GPROImg(28, 1);
        $this->model['succeedExList'] = Helper::GPROImg(33, 4);
        $this->model['zcfgImgList'] = Helper::GAImg(43, 1);
        $this->model['zcfgList'] = Helper::GA(43, 8);
        $this->model['jyImgList'] = Helper::GAImg(44, 1);
        $this->model['jyList'] = Helper::GA(44, 8);
        $this->model['cszxImgList'] = Helper::GAImg(45, 1);
        $this->model['cszxList'] = Helper::GA(45, 8);
        //org list
        $this->model['orgList'] = $this->orgService->orgDao->getList(QdcsOrg::class, 8);
        $this->model['orgRoot'] = $this->orgService->orgDao->getRoot();
        $this->model['zlCount'] = $this->projectService->projectDao->getClassIdCount(35);
        $this->model['zxCount'] = $this->projectService->projectDao->getClassIdCount(36);
        $this->model['zyCount'] = $this->projectService->projectDao->getClassIdCount(37);
        $this->model['zcCount'] = $this->projectService->projectDao->getClassIdCount(38);
        $this->model['zkCount'] = $this->projectService->projectDao->getClassIdCount(39);
        $this->model['zzCount'] = $this->projectService->projectDao->getClassIdCount(40);
        $this->model['zflCount'] = $this->projectService->projectDao->getClassIdCount(41);
        $this->model['zzyCount'] = $this->projectService->projectDao->getClassIdCount(42);
        return view('index', ['title' => '首页'], $this->model);
    }
}